

package com.hazelcast.map.impl.operation;

import com.hazelcast.map.impl.MapDataSerializerHook;
import com.hazelcast.spi.impl.operationservice.PartitionAwareOperation;
import com.hazelcast.spi.impl.operationservice.ReadonlyOperation;

public class MapSizeOperation extends MapOperation implements PartitionAwareOperation, ReadonlyOperation {

    private int size;

    public MapSizeOperation() {
    }

    public MapSizeOperation(String name) {
        super(name);
    }

    @Override
    protected void runInternal() {
        recordStore.checkIfLoaded();
        size = recordStore.size();
    }

    @Override
    public Object getResponse() {
        return size;
    }

    @Override
    public int getClassId() {
        return MapDataSerializerHook.SIZE;
    }
}
